<?php
/**
 * Get request parameter view helper
 * Use this view helper to retrieve any one of the request parameters (including
 * custom ones) from within the view (such as controller, action, etc.)
 *
 * @package 	Clients
 * @subpackage 	View Helpers
 * @author 		Luke Visinoni <luke.visinoni@gmail.com>
 * @copyright 	(c) 2011 Coalition Technologies <joel@coalitiontechnologies.com>
 * @version 	$Id$
 */
class Visi_View_Helper_GetRequestParam extends Zend_View_Helper_Abstract {

    protected $_request_params = false;
    
    public function getRequestParam($param, $default = '') {
    
        if (!$this->_request_params) {
            $request = Zend_Controller_Front::getInstance()->getRequest();
            $request_params = array (
                'module' => $request->getModuleName(),
                'controller' => $request->getControllerName(),
                'action' => $request->getActionName(),
            );
            $this->_request_params = array_merge($request_params, $request->getParams());
        }
        if (array_key_exists($param, $this->_request_params)) {
            return $this->_request_params[$param];
        }
        return $default;
    
    }

}